package xyz.scootaloo.draft;

import java.util.regex.Pattern;

/**
 * @author flutterdash@qq.com
 * @since 2021/3/26 22:23
 */
public class Case2 {

    public static void main(String[] args) {
        String test_phone_number_1 = "138ax128866"; // 不全是数字
        String test_phone_number_2 = "1388866";     // 长度不够11位
        String test_phone_number_3 = "23877778866"; // 不以1开头
        String test_phone_number_4 = "13877778866"; // 正常的号码
        System.out.println(match(test_phone_number_1));
        System.out.println(match(test_phone_number_2));
        System.out.println(match(test_phone_number_3));
        System.out.println(match(test_phone_number_4));
    }

    private static final Pattern mode = Pattern.compile("^138[0-9]{4}8866$");

    private static boolean match(String phoneNumber) {
        return mode.matcher(phoneNumber).matches();
    }

}
